package com.hd.controller;

import com.hd.pojo.Treatment;
import com.hd.service.CaseService;
import com.hd.service.TreatmentService;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * Created by 1 on 2017/11/23.
 */
@Controller
@RequestMapping("/director/caseEnter")
public class TreatmentController {

    private Integer caseNo = 0;

    @Resource
    private TreatmentService treatmentService;

    @Resource
    private CaseService caseService;

    @RequestMapping("/searchTreatment")
    public String searchTreatment(Model model){
        Treatment treatment = treatmentService.getMemberCase();
        if(treatment!=null) {
            model.addAttribute("treatment", treatment);
            caseNo++;
            model.addAttribute("caseNo", caseNo);
            Integer count = caseService.searchCaseNoNum(treatment.getMemberId());
            model.addAttribute("count",count);
        }
        return "director/caseEnter";
    }



}
